﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ZHDJ.MobileInterface
{
    public partial class GetExaminSpecial : AbstractBasePage
    {
        protected override OutParam BusinessProcess<InParam, OutParam>(InParam inParam)
        {
            // 业务逻辑返回的响应对象  
            ExaminSpecialOutParam result = new ExaminSpecialOutParam();
            ExaminSpecialInParam param = new ExaminSpecialInParam();
            string logMsg = "";
            bool isFlag = true;

            try
            {
                param = inParam as ExaminSpecialInParam;
                DataSet ds = InterfaceHelper.GetExaminSpecialList(param.SpecialID??"");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    ExaminSpecial es = new ExaminSpecial();
                    es.SpecialID = Convert.ToString(dr["SpecialID"]);
                    es.SpecialName = Convert.ToString(dr["SpecialName"]);
                    es.SpeciaDescription = CommonUtils.NoHTML( Convert.ToString(dr["SpeciaDescription"]));
                    result.data.Add(es);
                }


                logMsg = result.desc;
            }
            catch (Exception ex)
            {
                result.code = "0";
                result.desc = "操作异常，多次出现请联系管理员";
                logMsg = ex.Message + ":" + ex.StackTrace;
            }
             
            CommonUtils.InsertMobileInterfaceLog(SystemCode + "-GetExaminSpecial", SerializeHelper.JsonSerializer<ExaminSpecialInParam>(param), logMsg);
            return result as OutParam;
        }

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.Compare(Request.QueryString["Safe"], "False", true) == 0)
                ProcessRequest<ExaminSpecialInParam, ExaminSpecialOutParam>();
            else
                SafeProcessRequest<ExaminSpecialInParam, ExaminSpecialOutParam>();
        }
    }

    public class ExaminSpecialInParam
    {
        public string SpecialID { get; set; }
    }
    #region 结果参数
    public class ExaminSpecialOutParam
    {
        public ExaminSpecialOutParam()
        {
            code = "1";
            desc = "操作成功";

            data = new List<ExaminSpecial>();
        }

        /// <summary>
        /// 返回结果 具体见接口返回对照码 1	成功 0	失败 2	请求非法 加密结果和传入的MD5字符串进行比较，如果相同则执行接口操作，否则返回1001错误响应码
        /// </summary>
        public string code
        { get; set; }

        /// <summary>
        /// 结果描述 成功和失败都需要
        /// </summary>
        public string desc
        { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public List<ExaminSpecial> data
        { get; set; }
    }

    /// <summary>
    /// 
    /// </summary>
    public class ExaminSpecial
    {
        public string SpecialID { get;set ;}
        public string SpecialName { get; set; }
        public string SpeciaDescription { get; set; }
    }
    #endregion 

}